<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>选择权限</title>
<script type="text/javascript">
	function back() {
		 var functionString = '';
         var opElementArray = document.getElementsByName("op");
         for (var index=0;index<opElementArray.length;index++){
             var status = opElementArray[index-0].checked;
             if (status==true){
                 console.log("选中："+opElementArray[index-0].value);
                 functionString += opElementArray[index-0].value+'、';
             }
         }
         var index = functionString.length-1;
         functionString=functionString.slice(0,index);
         console.log("字符串值01为："+functionString);
         console.log("字符串值02为："+functionString);
         var functionsElement = window.opener.document.getElementById('function');
         functionsElement.value = functionString;
         console.log("字符串值03为："+functionString);
         window.close();
	}
</script>
</head>
<body>
<form>
	<dl>
		<c:forEach var="function" items="${allFunction }">
			<c:if test="${empty function.fatherFunction }">
				<dt><input type="checkbox" name="op" value=${function.functionName}>${function.functionName}</dt>
				<c:forEach var="functionSon" items="${allFunction}">
					<c:if test="${functionSon.fatherFunction.functionName==function.functionName}">
                    <dd><input type="checkbox" name="op"  value=${functionSon.functionName}>${functionSon.functionName}</dd>
                </c:if>   
				</c:forEach>
			</c:if>
		</c:forEach>
	</dl>
	<input type="button" value="返回" onclick="back()">
	<input type="reset" value="重置">
</form>
</body>
</html>